package com.inifitness.common.rabbitmq.consumer;

import java.time.LocalDateTime;
import java.util.Map;

import com.inifitness.common.rabbitmq.CustomRabbitConfig;
import com.inifitness.common.rabbitmq.message.DelayedMessage;
import com.rabbitmq.client.Channel;

import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;

/**
 * TODO:描述下该类的作用
 *
 * @author sunjinfeng
 * @version 1.0.0
 * @since 2023-02-01 17:18
 */
//@Component
@Log4j2
public class SmsConsumer {

  @RabbitListener(queues = CustomRabbitConfig.DELAYED_SMS_QUEUE)
  @RabbitHandler
  public void process(@Payload DelayedMessage msg, Channel channel,
      @Headers Map<String, Object> headers) {
    log.info("当前时间：{},短信队列接收到消息:{}", LocalDateTime.now(), msg);
    //smsService.sendBatchSms(msg.getMessages(), msg.getTemplateCode());
  }

}
